home *** CD-ROM | disk | FTP | other *** search
/ .net (French) 1996 December / .net Magazine (FR) - Issue 02 - Dec 1996.iso / Utilpers / SUPERQUE / DATA.2 / FILTERS / PSINIT / GS_STATD.PS < prev    next >
Text File  |  1995-12-26  |  9KB  |  231 lines

  1. %    Copyright (C) 1989, 1995 Aladdin Enterprises.  All rights reserved.
  2. %    Licensed to Zenographics Inc. (Irvine, California) by Artifex Software Inc.
  3. %    under the OEM Agreement of December 21st, 1993.
  4.  
  5. % This file provides statusdict, serverdict, and assorted LaserWriter
  6. % operators, mostly for the benefit of poorly designed PostScript programs
  7. % that 'know' they are running on a LaserWriter.
  8.  
  9. systemdict begin
  10.     % We make statusdict a little larger for Level 2 stuff.
  11.     % Note that it must be allocated in local VM.
  12.  .currentglobal false .setglobal
  13.  /statusdict 89 dict def
  14.     % To support the Level 2 job control features,
  15.     % serverdict must also be in local VM.
  16.  /serverdict 10 dict def        % ditto
  17.  .setglobal
  18. end
  19.  
  20. % Define various paper formats.  The Adobe documentation defines only these:
  21. % 11x17, a3, a4, a4small, b5, ledger, legal, letter, lettersmall, note.
  22. % These procedures are also accessed as data structures during initialization,
  23. % so the page dimensions must be the first two elements of the procedure.
  24.  
  25. /.setpagesize { //systemdict /statusdict get begin .setpagesize end } bind def
  26. userdict begin
  27.  /letter {612 792 //.setpagesize exec} bind def
  28.  /note {540 720 //.setpagesize exec} bind def
  29.  /legal {612 1008 //.setpagesize exec} bind def
  30.  /a0 {2380 3368 //.setpagesize exec} bind def  % ISO standard
  31.  /a1 {1684 2380 //.setpagesize exec} bind def  % ISO standard
  32.  /a2 {1190 1684 //.setpagesize exec} bind def  % ISO standard
  33.  /a3 {842 1190 //.setpagesize exec} bind def  % ISO standard
  34.  /a4 {595 842 //.setpagesize exec} bind def  % ISO standard
  35.  /a5 {421 595 //.setpagesize exec} bind def  % ISO standard
  36.  /a6 {297 421 //.setpagesize exec} bind def  % ISO standard
  37.  /a7 {210 297 //.setpagesize exec} bind def  % ISO standard
  38.  /a8 {148 210 //.setpagesize exec} bind def  % ISO standard
  39.  /a9 {105 148 //.setpagesize exec} bind def  % ISO standard
  40.  /a10 {74 105 //.setpagesize exec} bind def  % ISO standard
  41.  /b0 {2836 4008 //.setpagesize exec} bind def  % ISO standard
  42.  /b1 {2004 2836 //.setpagesize exec} bind def  % ISO standard
  43.  /b2 {1418 2004 //.setpagesize exec} bind def  % ISO standard
  44.  /b3 {1002 1418 //.setpagesize exec} bind def  % ISO standard
  45.  /b4 {709 1002 //.setpagesize exec} bind def  % ISO standard
  46.  /b5 {501 709 //.setpagesize exec} bind def  % ISO standard
  47.  /archE {2592 3456 //.setpagesize exec} bind def % U.S. CAD std
  48.  /archD {1728 2592 //.setpagesize exec} bind def % U.S. CAD std
  49.  /archC {1296 1728 //.setpagesize exec} bind def % U.S. CAD std
  50.  /archB {864 1296 //.setpagesize exec} bind def  % U.S. CAD std
  51.  /archA {648 864 //.setpagesize exec} bind def  % U.S. CAD std
  52.  /flsa {612 936 //.setpagesize exec} bind def  % U.S. foolscap
  53.  /flse {612 936 //.setpagesize exec} bind def  % European foolscap
  54.  /halfletter {396 612 //.setpagesize exec} bind def
  55.  /11x17 {792 1224 //.setpagesize exec} bind def  % 11x17 portrait
  56.  /ledger {1224 792 //.setpagesize exec} bind def  % 11x17 landscape
  57. end
  58. currentdict /.setpagesize undef
  59.  
  60. statusdict begin
  61.  
  62. % Define the pagetype values for the known page formats.
  63. % The values for all but letter and note are arbitrary.
  64. /.pagetypenames
  65.  { /letter /note /legal 
  66.    /a0 /a1 /a2 /a3 /a4 /a5 /a6 /a7 /a8 /a9 /a10
  67.    /b0 /b1 /b2 /b3 /b4 /b5 /archE /archD /archC /archB /archA
  68.    /flsa /flse /halfletter /11x17 /ledger
  69.  } cvlit readonly def
  70.  
  71. %%%%%% The following items were suggested by a user as useful.
  72.  
  73. % Permanent definitions
  74.  
  75. /ramsize         4194304 def
  76. /hardwareiomode        0 def
  77.     /sethardwareiomode     {pop} bind def
  78. /softwareiomode        0 def
  79.     /setsoftwareiomode     {pop} bind def
  80. /dosysstart        false def
  81.     /setdosysstart         {pop} bind def
  82. /allowjobreset      true def
  83.     /setallowjobreset      {pop} bind def
  84. /defaultpaperfamily    0 def
  85.     /setdefaultpaperfamily {pop} bind def
  86. /defaultpapertray      0 def
  87.     /setdefaultpapertray   {pop} bind def
  88. /defaulttrayswitch false def
  89.     /setdefaulttrayswitch  {pop} bind def
  90.  
  91. % Tray and format selection
  92.  
  93.  /11x17tray userdict /11x17 get def
  94.  /a3tray userdict /a3 get def
  95.  /a4tray userdict /a4 get def
  96.  /a5tray userdict /a5 get def
  97.  /a6tray userdict /a6 get def
  98.  /b4tray userdict /b4 get def
  99.  /flsatray userdict /flsa get def
  100.  /flsetray userdict /flse get def
  101.  /halflettertray userdict /halfletter get def
  102.  /ledgertray userdict /ledger get def
  103.  /legaltray userdict /legal get def
  104.  /lettertray userdict /letter get def
  105.  
  106. % Per-job parameters
  107.  
  108. /paperfamily 0 def    % 0 is US, 1 is European
  109. /papertray 1 def
  110.     /setpapertray {statusdict exch /papertray exch put} bind def 
  111. /trayswitch false def    % paperout feeds from another tray
  112. /papersize {/letter true} bind def    % <name of paper size>, <short-edge-first-p>
  113. /appletalktype (LaserWriter) def
  114.  
  115. %%%%%% The following items are defined in the PostScript Language
  116. %%%%%% Reference Manual, First Edition, and subsequent 'compatibility'
  117. %%%%%% documentation from Adobe.
  118.  
  119.  /checkpassword {statusdict begin .password eq end} bind def
  120.  /defaulttimeouts {statusdict begin .timeouts aload pop end} bind def
  121. %/dostartpage
  122.  /eescratch {pop 0} bind def
  123.  /idlefonts {statusdict begin mark .idlefonts aload pop end} bind def
  124.  /jobname () def
  125. %/jobtimeout
  126.  /manualfeed false def
  127.  /manualfeedtimeout 60 def
  128.  /margins {statusdict begin .topmargin .leftmargin end} bind def
  129.  /pagecount {4711} bind def
  130.  /pagestackorder {false} bind def
  131.  /pagetype 0 def
  132.  /prefeed false def
  133.  /printererror {pop pop} bind def
  134.  /printername {statusdict /.printername get exch copy} bind def
  135.  /processcolors /processcolors load def        % defined in systemdict
  136.  /product product def        % product is defined in systemdict
  137.  /revision revision def        % revision is defined in systemdict
  138.  /sccbatch {pop 9600 0} bind def
  139.  /sccinteractive {pop 9600 0} bind def
  140.  /setdefaulttimeouts {statusdict begin .timeouts astore pop end} bind def
  141.  /setdostartpage {statusdict exch /dostartpage exch put} bind def
  142.  /setduplexmode {mark /Duplex 3 -1 roll currentdevice putdeviceprops} bind def
  143.  /seteescratch {pop pop} bind def
  144.  /setidlefonts {] statusdict exch /.idlefonts exch put} bind def
  145.  /setjobtimeout {statusdict exch /jobtimeout exch put} bind def
  146.  /setmargins
  147.   { statusdict begin
  148.     /.leftmargin exch def /.topmargin exch def
  149.     end
  150.   } bind def
  151.  
  152. % setpage and setpageparams aren't properly documented by Adobe.
  153. %
  154. %    <width> <height> <orientation> setpage -
  155. %    <width> <height> <offset> <orientation> setpageparams -
  156. %
  157. % width and height are in default units (and if orientation is 1, are
  158. % exchanged!).  offset is the x margin, also in default units.
  159. % Unfortunately, because orientation is relative to the device paper feed,
  160. % it does not have a consistent meaning in terms of image orientation.
  161. % We follow the convention that ORIENT1 determines the orientation value
  162. % that means portait: false means 0, true means 1.
  163.  
  164.  /setpage {ORIENT1 { 1 } { 0 } ifelse ne {exch} if .setpagesize} bind def
  165.  /setpageparams {exch pop ORIENT1 { 1 } { 0 } ifelse ne {exch}if .setpagesize} bind def
  166.  /setpagetype
  167.   { statusdict begin
  168.       dup .pagetypenames exch get systemdict exch get exec
  169.       /pagetype exch def
  170.     end
  171.   } bind def
  172.  /setpassword
  173.   {exch checkpassword
  174.     {statusdict exch /.password exch put true}
  175.     {pop false}
  176.    ifelse} bind def
  177.  /setprintername
  178.   {dup length string copy statusdict exch /.printername exch put} bind def
  179.     % setresolution is not documented by Adobe, but some applications
  180.     % use it anyway, without testing whether or not it is present.
  181.  
  182. % setresolution is not documented by Adobe.
  183. %
  184. %    <pixels_per_inch> setresolution -
  185. %
  186. % sets the resolution of the device.
  187.  
  188.  /setresolution
  189.   { mark /HWResolution [ 4 -1 roll dup ] currentdevice putdeviceprops pop
  190.     initmatrix erasepage
  191.   } bind def
  192.  /setsccbatch {pop pop pop} bind def
  193.  /setsccinteractive {pop pop pop} bind def
  194.  /settumble {pop} bind def
  195.  /waittimeout 300 def
  196.  
  197. %%%%%% End of documented items.
  198.  
  199. /.setpagesize
  200.  { mark /HWSize [
  201.      4 index 4 index matrix defaultmatrix dtransform
  202.      abs ceiling cvi exch abs ceiling cvi exch
  203.    ] currentdevice putdeviceprops pop pop pop
  204.    initmatrix initclip erasepage
  205.  } bind def
  206. /.password 0 def
  207. /.timeouts [0 60 30] def
  208. true setdostartpage
  209. mark setidlefonts
  210. 0 setjobtimeout
  211. 0 0 setmargins
  212. product setprintername
  213.  
  214. end    % statusdict
  215.  
  216. % The following contents of serverdict are a complete guess,
  217. % based on some observed LaserWriter boilerplate.
  218.  
  219. serverdict begin
  220.  
  221.  /execjob { } bind def
  222. % The Red Book implies that something like the following is
  223. % an appropriate definition of exitserver.
  224.  /exitserver { clear stop } bind def
  225. % However, this interacts badly with our standard error handler,
  226. % so we override it with the following less appropriate definition.
  227.  /exitserver { 0 ne { clear cleardictstack } if } bind def
  228.  /setrealdevice { } bind def
  229.  
  230. end    % serverdict
  231.